<?php

namespace App\Http\Controllers\User;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;

class IndexController extends Controller
{
    //
    public function getFiled(){
        try{

            $chose = DB::table('filed')->get();

            return json_encode(['msg'=>0,'data' => $chose]);

        }catch (Exception $e){

            $info =  $e->getMessage().'failed line:'.$e->getLine().'failed string:'.$e->getTraceAsString();
            return json_encode(['msg'=>0,'data' => $info]);
            exit;
        }
    }

    public function index(Request $request)
    {
        if ( $request->has('pwd') && $request->get('pwd') == 123)
        {
            return redirect('aaa/index-main.html');
        }
        else
        {
            return view('errors.404');
        }
    }
}
